package com.how2java.tmall.service;

import com.how2java.tmall.dao.DepositDAO;
import com.how2java.tmall.dao.FavoriteDao;
import com.how2java.tmall.pojo.Deposit;
import com.how2java.tmall.pojo.Favorite;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class DepositService {
    @Autowired
    DepositDAO depositDAO;

    public void add(Deposit deposit) {
        depositDAO.save(deposit);
    }

    public Deposit getByDepositId(Integer depositId) {
        return depositDAO.getOne(depositId);
    }


    public List<Deposit> byUserIdAndGoodsId(int userId, int pid) {
        return depositDAO.findByUserIdAndGoodsId(userId, pid);
    }
}
